package cn.iocoder.yudao.module.hs.controller.admin.bigscreen;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.hs.controller.admin.bigscreen.vo.*;
import cn.iocoder.yudao.module.hs.service.bigscreen.BigScreenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Tag(name = "管理后台 - 数据大屏")
@RestController
@RequestMapping("/hs/big-screen")
@Validated
public class BigScreenController {

    @Resource
    private BigScreenService bigScreenService;

    @GetMapping("/tripartite-material-chart")
    @Operation(summary = "数据大屏-三方仓物料图表")
    public CommonResult<BigScreenTripartiteMaterialChartVO> tripartiteMaterialChart() {
        BigScreenTripartiteMaterialChartVO vo = bigScreenService.getTripartiteMaterialChart();
        return CommonResult.success(vo);
    }

    @GetMapping("/material-data")
    @Operation(summary = "数据大屏-物料数量统计")
    public CommonResult<BigScreenMaterialCountVO> materialData() {
        BigScreenMaterialCountVO vo = bigScreenService.getMaterialCount();
        return CommonResult.success(vo);
    }

    @GetMapping("/operate-record")
    @Operation(summary = "数据大屏-操作记录")
    public CommonResult<List<BigScreenOperateRecord>> operateRecord() {
        List<BigScreenOperateRecord> list = bigScreenService.operateRecord();
        return CommonResult.success(list);
    }

    @GetMapping("/warehouse-material-data")
    @Operation(summary = "数据大屏-仓库-物料数据统计")
    public CommonResult<List<WarehouseMaterialData>> warehouseMaterialData() {
        List<WarehouseMaterialData> list = bigScreenService.warehouseMaterialData();
        return CommonResult.success(list);
    }

    @GetMapping("/warehouse-customer-status")
    @Operation(summary = "数据大屏-终端-状态统计")
    @Parameter(name = "queryScopeType", description = "查询时间范围类型1-日;2-周;3-月", required = true)
    public CommonResult<List<WarehouseCustomerCountData>> warehouseCustomerStatus(@RequestParam("queryScopeType") int queryScopeType) {
        return CommonResult.success(bigScreenService.warehouseCustomerStatus(queryScopeType));
    }

    @GetMapping("/warehouse-tripartite-status")
    @Operation(summary = "数据大屏-三方仓-状态统计")
    @Parameter(name = "queryScopeType", description = "查询时间范围类型1-日;2-周;3-月", required = true)
    public CommonResult<List<WarehouseTripartiteCountData>> warehouseTripartiteStatus(@RequestParam("queryScopeType") int queryScopeType) {
        return CommonResult.success(bigScreenService.warehouseTripartiteStatus(queryScopeType));
    }
}
